<?php

namespace app\models;

use think\Model;

class Admin extends Model
{
    protected $pk = 'id';
    protected $autoWriteTimestamp = 'datetime';
    protected $createTime = 'created';
    protected $updateTime = 'updated';



    public static function Operlog($aid = 0, $context = '', $dates = '')
    {
        $res = (new AdminOperlog())->save([
            'aid' => time(),
            'content' => $context,
            'dates' => $dates
        ]);
        if (!$res) {
            throw new \Exception("日志添加失败", 100);
        }
    }
}
